
{% extends 'nianhui/nianhui.html' %}
{% block content %}
<script type="text/javascript">
	app.controller('content',function ($scope,$http) {
		$scope.btn_txt='点赞';
		$scope.can_zhan=true;
		$scope.zhan_number ={{number}};
		$scope.can_zhan={{can_zhan}};
		$scope.dian_zhan=function(jiemu){
				//$scope.zhan_number+=1;
				$scope.can_zhan=false;
				$scope.btn_txt='已赞';

				var postData = {
					operation:'dian_zhan',
					user:'hahaer'
				};  
				$http.post('',postData)
				.success(function(data, status, headers, config) {  
				    //加载成功之后做一些事  
				    $scope.zhan_number=data.number;
				    //$scope.zhan_text='已经有'+data.number+'个赞';
				    alert(data.msg);
				    
				    
				}).error(function(data, status, headers, config) {  
				    //处理错误 
				    $scope.msg='有错误,返回码为:',
				    $scope.msg+=status; 
				});
				}  
		}
		);
</script>
<div ng-controller='content'>
	<div>
		{{ jiemu_html |safe }}
	</div>
	<div>已经有:<span ng-bind='zhan_number' style='color:red'></span>个赞</div>
	<button name="dian_zhan" type="button" value="val" ng-click='dian_zhan()' ng-bind='{true:"点赞",false:"已赞"}[can_zhan]' ng-disabled='!can_zhan' class="btn btn-success"></button>
</div>
{% endblock %}